const express = require('express');
const app = express();
let apiRoutes = express.Router();

let data = require('./public/data');
let drugs = data.drugs;
let hotDrugs = data.hotDrugs;
let categorys = data.categorys;

app.use('/api', apiRoutes);

module.exports = {
    devServer: {
        before(app) {
            app.get('/api/drugs', (req, res) => {
                res.json({
                    data: drugs
                })
            });
            app.get('/api/hotDrugs', (req, res) => {
                res.json({
                    data: hotDrugs
                })
            });
            app.get('/api/categorys', (req, res) => {
                res.json({
                    data: categorys
                })
            });
        }
    }
};
